function calLVR() {
    var loanAmount = document.getElementById("lender_loanAmount").value;//addClient.lender_loanAmount.value;
    var packageAmount = document.getElementById("builder_packageAmount").value;//addClient.builder_packageAmount.value;
    var lvr;
    if (packageAmount == 0) {
        lvr = '';
    } else {
        lvr = (loanAmount/packageAmount) * 100;
    }
    document.getElementById("lender_lvr").value=(Math.round(lvr*100)/100);
}

function calTotalPRM() {
    var financialBroker =  document.getElementById("prm_financialBroker").value;//addClient.lender_loanAmount.value;
    var legals = document.getElementById("prm_legals").value;//addClient.builder_packageAmount.value;
    var builders = document.getElementById("prm_builders").value;
    var financialPlanner = document.getElementById("prm_financialPlanner").value;
    var prmSum = parseFloat(financialBroker) + parseFloat(legals) + parseFloat(builders) + parseFloat(financialPlanner);
    document.getElementById("prm_sum").value=prmSum;
}

function calPackageAmount() {
    var landAmount =  document.getElementById("builder_landAmount").value;//addClient.lender_loanAmount.value;
    var constructionAmount = document.getElementById("builder_constructionAmount").value;//addClient.builder_packageAmount.value;
    var packageAmountSum = parseFloat(landAmount) + parseFloat(constructionAmount);
    document.getElementById("builder_packageAmount").value=packageAmountSum;
}

function addLvrListener() {
    listen = {}
    loanAmount = document.getElementById("lender_loanAmount");
    listen.onChanged = function(loanAmount){
        calLVR();
    }
    packageAmount = document.getElementById("builder_packageAmount");
    listen.onChanged = function(packageAmount){
        calLVR();
    }
    document.getElementById("lender_lvr").addListener(listen);
}